#ifndef _DROP_H_
#define _DROP_H_

#include <map>
#include <vector>

//#include "../xldata/etctable.h"
#include "../NResource/DungeonResource.h"
#include "../NResource/BalanceResource.h"

#define DROP_MONEY_SPLIT_MIN	50	// 골드 드랍 분리 최소 상수
#define DROP_MONEY_SPLIT_MAX	20	// 골드 드랍 분리 최대 상수


namespace ProjectZ { namespace NLogic {

enum DropItemType
{
	DROP_ITEM_WEAPONE = 0,
	DROP_ITEM_DEFENSE,
	DROP_ITEM_ACCESSARY,
	DROP_ITEM_ETC,
	DROP_ITEM_MAX
};

enum DungeonThemeType
{
	DUNGEON_THEME_FOREST1	= 1,
	DUNGEON_THEME_CAVE1,
	DUNGEON_THEME_CANYON1,
	DUNGEON_THEME_TEMPLE1,
	DUNGEON_THEME_FOREST2,
	DUNGEON_THEME_CAVE2,
	DUNGEON_THEME_CANYON2,
	DUNGEON_THEME_EVENT,
	DUNGEON_THEME_DLC1,
	DUNGEON_THEME_DLC2,
	DUNGEON_THEME_DLC3,
	DUNGEON_THEME_DLC4
};

class Drop
{
public:
	// drop item 조합을 위하여 정의
	struct ItemValue
	{
		int tid;
		int sheet;
		int classType;
		int itemseq;
	};

	typedef std::vector<ItemValue> ITEMVALUEVECTOR;

public:
	Drop();
	virtual ~Drop();

	void ItemDrop(User * pUser, int defenderGID);
	int GetDropItemQuality(NResource::BalanceData * pBalance, int dungeonMode);

private :
	bool IsItemDrop(User * pUser, NResource::BalanceData * pBalance, int dungeonMode, int playerCount, int is_legend, bool bBoss=false);
	bool IsItemDropEventDungeon(User * pUser, NResource::DungeonData::Flyweight * pDungeon);

	int GetClassType();
	int GetDropType(NResource::BalanceData * pBalance);
	int GetItemTID(NResource::DungeonData::Flyweight * pDungeon, int defenderGID, int dropType, int monster_tid, int monster_level);
	int GetItemTIDEventDungeon(NResource::DungeonData::Flyweight * pDungeon);
	int GetItem4Sheet(NResource::DungeonData::Flyweight * pDungeon, int defenderGID, int dropType, int monster_tid, int monster_level);

	int GetDefenseSheet();
	int GetAccessarySheet();
	int GetEventDungeonDropCount(NResource::DungeonData::Flyweight * pDungeon);

	void GetDropGold(NResource::BalanceData * pBalance, int defenderGID, int monster_level, int dungeonMode, int playerCount, std::vector<int> &goldVector, int isLegend, bool bBoss=false);
	void SendPacket(User * pUser, int defenderGID, int classType, int sheet, int tid, int itemQuantity, std::vector<int> &goldVector, ITEMVALUEVECTOR & clsItemValueVector);
	void InitDropItemMap(int table_id, int dropType, bool bItem4Type=false);

	void	questItemDrop(User * pUser, NResource::BalanceData * pBalance, NResource::DungeonData::Flyweight * pDungeon, int defenderGID, ITEMVALUEVECTOR & clsItemValueVector, int monsterTid);
	int		getQuestIdx(NResource::DungeonData::Flyweight * pDungeon, int monsterTid, int & questItemIdx);
	//void	sendDropQuestItem(User * pUser, int defenderGID, int classType, int sheet, int tid, int itemQuantity, int itemseq);

//private:
//	std::map< int, int > dropItemMap;

//	std::vector< int > sheetDefenseVector;
//	std::vector< int > sheetAccessaryVector;

//	std::map< int, NXLData::ETCTABLE_DUNGEON const * > dungeonMap;
};


} /*NLogic*/ } /*ProjectZ*/


#endif
